package com.lanju.app.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import com.lanju.app.message.bean.B109Request;
import com.lanju.app.message.bean.B109Response;
import com.lanju.app.message.bean.B109Response.CateBean;
import com.lanju.entity.ProductCate;
import com.lanju.entity.User;

/**
 * 获取所有目录
 * @author fly
 *
 */
@Service("B109Service")
public class B109Service extends BaseService<B109Request,B109Response>{

	@Override
	public B109Response doService(B109Request request, User u) throws Exception {
		B109Response res = new B109Response();		
		List<ProductCate> cases = dao.list(ProductCate.class, null);
		List<CateBean> list = new ArrayList<>();
		for(ProductCate cate: cases){
			CateBean bean = new CateBean();
			BeanUtils.copyProperties(cate, bean);
			list.add(bean);
		}
		res.setCates(list);
		res.setSuccess(true);
		return res;
	}
}
